var baseUrl = "https://music.aityp.com/";
function http({ url, data }) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: baseUrl + url,
      data,
      header: { 'content-type': 'application/json' },
      method: 'GET',
      dataType: 'json',
      responseType: 'text',
      success: (res) => {
        wx.hideToast();
        resolve(res.data)
      },
      fail: (err) => {
        reject(err)
      }
    });
  })
}

module.exports = {
  /* 获取语言的歌单请求 */
  getLanguage(cat){
    return http({url:"top/playlist",data:{cat,}})
  },

/* 前往歌单详情页 */
  getDetail(id) {
    return http({ url: "playlist/detail", data: { id } })
  },

 

  /* 获取歌曲播放链接接口 */
  getSongUrl(id) {
    return http("song/url", { id })
  },
   
   getMore(cat,offset) {
      return http({url:"top/playlist",
         data:{  
           cat,
            offset
         }});
   }

}